//package com.han.school.controller;
//
//import org.flowable.engine.TaskService;
//import org.flowable.engine.runtime.ProcessInstance;
//import org.flowable.engine.RuntimeService;
//import org.flowable.task.api.Task;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.util.HashMap;
//import java.util.List;
//
//@RestController
//public class AskLeaveController {
//
//    @Autowired
//    private RuntimeService runtimeService;   //与正在执行的流程实例和执行对象相关的Service(执行管理，包括启动、推进、删除流程实例等操作)
//
//    @Autowired
//    private TaskService taskService;
//    @RequestMapping("/askLeave")
//    public String studentToTeacher(String staffId){
//        HashMap<String, Object> map = new HashMap<>();
//        map.put("staffId",staffId);
//        ProcessInstance processInstance = runtimeService.startProcessInstanceById("leave",map);
//        StringBuilder sb = new StringBuilder();
//        sb.append("创建请假流程 processId：" + processInstance.getId());
//        List<Task> tasks = taskService.createTaskQuery().taskAssignee(staffId).orderByTaskCreateTime().desc().list();
//        for (Task task : tasks) {
//            sb.append("任务taskId:" + task.getId());
//        }
//        return sb.toString();
//    }
//}
